﻿using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.IO;
using System.Data.Linq.Mapping;
using System.Collections.Generic;

namespace Delay
{
    [Table]
    public class CollectTable : INotifyPropertyChanged
    {
        private int _index;
        [Column(IsPrimaryKey = true, CanBeNull = false, IsDbGenerated = true, DbType = "INT NOT NULL Identity", AutoSync = AutoSync.OnInsert)]
        public int Index
        {
            get
            {
                return _index;
            }
            set
            {
                if (_index != value)
                {
                 
                    _index = value;
                    NotifyPropertyChanged("Index");
                }

            }
        }
        private string _title;
         [Column]
        public string Title
        {
            get
            {
                return _title;
            }
            set
            {
                if (_title != value)
                {
                    _title = value;
                    NotifyPropertyChanged("Title");
                }
            }
        }
        //前面这些项是本级Ui用的
        //下面的这些自动属性石下一级UI用的，即点击回复的时候用的
        //这几个需要从属性中读出，不是从节点中读出
        public string _readcount;
        [Column]
        public string Readcount
        {
            get
            {
                return _readcount;
            }
            set
            {
                if (_readcount != value)
                {
                    _readcount = value;
                    NotifyPropertyChanged("Readcount");
                }
            }
        }
        private string _replycount;
        [Column]
        public string Replycount
        {
            get
            {
                return _replycount;
            }
            set
            {
                if (_replycount != value)
                {
                    _replycount = value;
                    NotifyPropertyChanged("Replycount");
                }
            }
        }
     
        private string _topid;
        [Column]
        public string Topicid
        {
            get
            {
                return _topid;
            }
            set
            {
                if (_topid != value)
                {
                    _topid = value;
                    NotifyPropertyChanged("Topicid");
                }
            }
        }         
        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
       
        // 用来通知数据上下文表的字段数据将要产生改变        
    }
}
